#include "CommandMovePawn.h"
#include "CommandAction.h"

CommandMovePawn::CommandMovePawn(CommandAction* action, PlayerModel* player, Position* oldPos, Position* newPos) {
	this->action = action;
	this->player = player;
	this->oldPos = oldPos;
	this->newPos = newPos;
}

void CommandMovePawn::doo() {
	action->doMovePawn(player, *newPos);
}

void CommandMovePawn::undo() {
	action->validateMovePawn(player, *oldPos);
}

bool CommandMovePawn::check() {
	return true;
}

void CommandMovePawn::validate() {
	action->validateMovePawn(player, *newPos);
}

void CommandMovePawn::cancel() {
	action->doMovePawn(player, *oldPos);
}